package DataStructure.array.swordOffer2;

/**
 * 剑指 Offer 11. 旋转数组的最小数字 https://leetcode.cn/problems/xuan-zhuan-shu-zu-de-zui-xiao-shu-zi-lcof
 */
public class MinArray {

    /**
     * 思路：找转折点，若没有转折点，则旋转数组的最小数字为numbers[0]
     */
    public int minArray(int[] numbers) {
        for(int i = 0;i < numbers.length-1;i++) {
            if(numbers[i] > numbers[i+1]) return numbers[i+1];
        }
        return numbers[0];
    }
}
